package com.example.jl.bethinner.util;

import com.example.jl.bethinner.view.AutoTextView;

import java.util.List;

/**
 * Created by bethinner on 1/18/16.
 */
public class ATViewUtils {
    private List<String> stringList;
    private AutoTextView autoTextView;
    private int position =0;

    public ATViewUtils(List<String> stringList,AutoTextView autoTextView) {
        this.stringList = stringList;
        this.autoTextView = autoTextView;
        position=0;
        if (null!=stringList){
            autoTextView.setText(stringList.get(0));
        }else {
            autoTextView.setText("数据不能为空");
        }
    }

    public int getPosition() {
        return position;
    }

    public void setPosition(int position) {
        this.position = position;
    }

    public void next(){
        autoTextView.next();
        if (null!=stringList){
            if (position<stringList.size()-1){
                position++;
            }
            else {
                position=stringList.size()-1;
            }
//            autoTextView.setText(stringList.get(position));
        }
    }
    public void previous(){
        autoTextView.previous();
        if (null!=stringList){
            if (position>0){
                position--;
            }
            else {
                position=0;
            }
//            autoTextView.setText(stringList.get(position));
        }
    }
}